]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
unlockDialog: only emit 'failed' on reset after failure/cancel
authorRay Strode <rstrode@redhat.com>
Sun, 28 Jul 2013 20:06:04 +0000 (16:06 -0400)
committerRay Strode <rstrode@redhat.com>
Mon, 19 Aug 2013 01:14:35 +0000 (21:14 -0400)
We currently emit "failed" any time the UserVerifier is reset,
and user verification didn't succeed prior.

A more conceptually clear time to emit "failed" would be if
the UserVerifier is reset and user verification failed prior,
and to emit "failed" if the user cancels unlock.

This commit restructures things to do that. Aside from being
more conceptually clear, it also lays the groundwork for us
to be able to reset the unlock screen without failing.

https://bugzilla.gnome.org/show_bug.cgi?id=683437

js/gdm/authPrompt.js
js/ui/unlockDialog.js

index 253582e66b45459ab711120fdf28e30708adefc1..15841a3fb3f4bd47edd94e3bb22bd30ac897bcca 100644 (file)
@@ -428,6 +428,9 @@ const AuthPrompt = new Lang.Class({
         this.stopSpinning();
         this.setHint(null);
 
+        if (oldStatus == AuthPromptStatus.VERIFICATION_FAILED)
+            this.emit('failed');
+
         this.emit('reset');
     },
 
@@ -468,6 +471,7 @@ const AuthPrompt = new Lang.Class({
 
     cancel: function() {
         this.reset();
+        this.emit('cancelled');
     }
 });
 Signals.addSignalMethods(AuthPrompt.prototype);
index 1fc55eb7038a573cde32238e3fa5545ab83c114e..8f30d6e955286955d48323ece67094e5d95b0a75 100644 (file)
@@ -49,7 +49,8 @@ const UnlockDialog = new Lang.Class({
                                                                      factor: 0.5 }));
 
         this._authPrompt = new AuthPrompt.AuthPrompt(new Gdm.Client(), AuthPrompt.AuthPromptMode.UNLOCK_ONLY);
-        this._authPrompt.connect('reset', Lang.bind(this, this._onReset));
+        this._authPrompt.connect('failed', Lang.bind(this, this._fail));
+        this._authPrompt.connect('cancelled', Lang.bind(this, this._fail));
         this._authPrompt.setUser(this._user);
         this._authPrompt.setPasswordChar('\u25cf');
         this._authPrompt.nextButton.label = _("Unlock");
@@ -92,15 +93,13 @@ const UnlockDialog = new Lang.Class({
         }
     },
 
-    _onReset: function() {
+    _fail: function() {
         this.emit('failed');
     },
 
     _escape: function() {
-        if (this.allowCancel) {
+        if (this.allowCancel)
             this._authPrompt.cancel();
-            this.emit('failed');
-        }
     },
 
     _otherUserClicked: function(button, event) {